#include<iostream>
#include<assert.h>
using namespace std;

class Date
{
public:
	// 全缺省构造函数
	Date(int year = 1, int month = 1, int day = 1);
	Date(const Date& d);
	bool CheckInvalid() const;
	// 判断日期大小
	bool operator<(const Date& d) const;
	bool operator==(const Date& d) const;
	bool operator<=(const Date& d) const;
	bool operator>(const Date& d) const;
	bool operator>=(const Date& d) const;
	bool operator!=(const Date& d) const;

	// d1 += 100
	Date& operator+=(int day);
	Date operator+(int day) const;
	// d1 - 100
	Date& operator-=(int day);
	Date operator-(int day) const;

	// 前置++
	Date& operator++();
	// 后置++
	Date operator++(int);
	// 前置--
	Date& operator--();
	// 后置--
	Date operator--(int);
	// d1 - d2
	int operator-(const Date& d) const;
	// 本质就是内联inline
	int GetMonthDay(int year, int month) const
	{
		assert(month > 0 && month < 13);
		static int monthDay[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

		if (month == 2 && ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)))
		{
			return 29;
		}
		return monthDay[month];
	}

	// 打印函数
	void Print() const
	{
		cout << _year << "-" << _month << "-" << _day << endl;
	}
private:
	int _year;
	int _month;
	int _day;
};